public class Work02 {
    static long fastPow(int a,int n){
        long ans = 1;
        while (n > 0){
            if((n & 1) ==1){
                ans *= a;
            }
            a *= a;
            n >>= 1;
        }
        return ans;
    }
    public static void main(String[] args) {
        System.out.println(fastPow(2, 3));
    }
}
